package ext.tianma.change.validator;

import wt.change2.WTChangeOrder2;
import wt.fc.Persistable;
import wt.fc.WTReference;

import com.ptc.core.ui.validation.DefaultUIComponentValidator;
import com.ptc.core.ui.validation.UIValidationCriteria;
import com.ptc.core.ui.validation.UIValidationKey;
import com.ptc.core.ui.validation.UIValidationStatus;

public class ModifiedFinishedGoodTableBuilderValidator extends DefaultUIComponentValidator {

	/**
	 * 通过validator控制在“更改通告”页面客制化的一个builder
	 */
	@Override
	public UIValidationStatus preValidateAction(UIValidationKey uiValidationKey, UIValidationCriteria uiValidationCriteria) {
		UIValidationStatus uiValidationStatus = UIValidationStatus.HIDDEN ;
		
		WTReference wtreference = uiValidationCriteria.getContextObject();
		
		if( wtreference != null ){
			
			Persistable persistable = wtreference.getObject();
			
			if( persistable != null && persistable instanceof WTChangeOrder2){
				
				uiValidationStatus = UIValidationStatus.ENABLED ;
			}
		}
		
		return uiValidationStatus ;
	}
	
}
